<template>
    <div>
        <tableList
            :apis="apis"
            :searchItems="searchItems"
            :headItems="headItems"
            :actItems="actItems"
            :formWidth="formWidth"
            :formItems="formItems"
            @actButEvent="actButEvent"
        ></tableList>
    </div>
</template>

<script>
    import globalMixin from '@/mixins/global'
    export default {
        name: 'abnormal-list',
        mixins: [globalMixin],
        data () {
            return {
                apis: {
                    list: {
                        url: this.$api.V2X_ABNORMAL_GET,
                        params: {
                            with: 'abnormalTypes;lidars;locations;objTypes',
                            sortedBy: 'desc',
                            orderBy: 'id'
                        }
                    },
                },
                searchItems: [
                    /*{
                        type: "select",
                        key: 'local_id',
                        label: '架设地',
                        placeholder: '请选择架设地',
                        options: JSON.parse(sessionStorage.getItem('location-info'))
                    },*/
                    {
                        type: "selectGroup",
                        key: 'lidar_id',
                        label: this.$t('page.abnormal.list.lidar.name'),
                        placeholder: this.$t('page.abnormal.list.lidar.placeholder'),
                        options: JSON.parse(sessionStorage.getItem('location-info'))
                    },
                    {
                        type: "select",
                        key: 'obj_type',
                        label: this.$t('page.abnormal.list.objtype.name'),
                        placeholder: this.$t('page.abnormal.list.objtype.placeholder'),
                        options: JSON.parse(sessionStorage.getItem('objType-info'))
                    },
                    {
                        type: "daterange",
                        key: "date",
                        splaceholder: "",
                        eplaceholder: ""
                    }
                ],
                headItems: [
                    { key: 'event_id', label: this.$t('page.abnormal.list.headitems.event_id') },
                    { key: 'lidars.name', label: this.$t('page.abnormal.list.headitems.name') },
                    { key: 'locations.location_name', label: this.$t('page.abnormal.list.headitems.locations') },
                    { key: 'abnormal_types.abnormal_msg_cn', label: this.$t('page.abnormal.list.headitems.abnormal_types') },
                    { key: 'image_url', label: this.$t('page.abnormal.list.headitems.image_url'), type: 'image' },
                    { key: 'car_id', label: this.$t('page.abnormal.list.headitems.car_id') },
                    { key: 'obj_types.obj_name_cn', label: this.$t('page.abnormal.list.headitems.obj_types') },
                    { key: 'created_at', label: this.$t('public.form.created_at'), type: 'datetime' },
                ],
                actItems: [],
                formWidth: '500',
                formItems: [],
            }
        },
        mounted() {
        },
        methods: {
            searchEvent(e) {
                console.log(e)
            },
            actButEvent(e) {
                this[e.eventName](e.val);
            },
            detailAct(e) {
                this.actStatus = e.status;
                this.title = e.time;
                this.id = e.id;
                this.apisAddDeduction.list.params.id = e.id;
                this.dialogDetailActVisible = true;
                this.formLoading = true;
                this.detailHeader();
                this.apisDetailAct.list.params.id = e.id;
                this.apisDetailAct.export.params.id = e.id;
                this.apisDetailAct.total.params.id = e.id;
            },
        }
    }
</script>
